<script>
layui.use(['form', 'layedit'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,layedit = layui.layedit
    
 
  //表单初始赋值
  form.val('example', {
	"UserId":{{.User.UserId}}
    ,"UserName": {{.User.UserName}} 
    ,"UserKey": {{.User.UserKey}}
	,"Password":{{.User.PassWord}}
	,"Password1":{{.User.PassWord}}
  })

  //监听提交
  form.on('submit(demo1)', function(data){ 
	parent.location.reload();
	var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
	parent.layer.close(index); //再执行关闭    
  });
  
  
});
</script>